package com.qf.day04;

public class arr2 {
    /**
     * 拷贝数组
     * @param arr1      原数组
     * @param oldstart  原数组的起始位置
     * @param arr2      新数组
     * @param newstart  新数组的起始位置
     * @param length    拷贝的长度
     */
    public static void main(String[] args) {
        int [] oldArr = {5,2,7,64,185,12};
        int [] newArr = new int[oldArr.length];
        copyArr(oldArr,2,newArr,1,3);
        for (int i = 0; i < newArr.length; i++) {
            System.out.print(newArr[i] +" ");
        }
    }
    public static void copyArr(int[] arr1,int oldStart,int[] arr2,int newStart,int length){

        for (int i = 0; i <length ; i++) {

            arr2[i+newStart] = arr1[i+oldStart];

        }
    }

}
